package com.sec.android.app.myfiles.module.download.providerapps;

import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;

import com.sec.android.app.myfiles.module.download.DownloadObserverImp;

public abstract class AbsContentObserver extends ContentObserver {
    private ContentResolver mContentResolver;
    private DownloadObserverImp mObserveImp;
    protected abstract Uri getUri();

    public AbsContentObserver(Handler handler, Context context, DownloadObserverImp observeImp) {
        super(handler);
        mContentResolver = context.getContentResolver();
        mObserveImp = observeImp;
    }

    public void register() {
        mContentResolver.registerContentObserver(getUri(), true, this);
    }

    public void unregister() {
        mContentResolver.unregisterContentObserver(this);
    }

    @Override
    public void onChange(boolean selfChange) {
        super.onChange(selfChange);
        mObserveImp.onEvent(0);
    }
    
    
}
